scrapbox.Page.linesのreverse engineering
format後の82262行目から
コードブロック記法がない?
code:js
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.getPageMetadataFromLines = function getPageMetadataFromLines(n) {
var i = [
],
s = [
],
A = [
],
j = [
],
B = [
];
for (var $ of(0, _.default) (n)) if (!($.title || $.codeBlock || $.cli || $.helpfeel)) {
j.length < 5 && !(0, E.isEmptyLine) ($) && j.push($.text.trim().slice(0, 200));
var ne = (0, w.parseScrapboxSyntax) ($.text);
i = i.concat((0, w.getLinksFromNode) (ne)),
s = s.concat((0, w.getImagesFromNode) (ne)),
A = A.concat((0, w.getIconsFromNode) (ne)),
B = B.concat((0, w.getFilesFromNode) (ne))
}
return i = (0, P.uniq) (i),
s = (0, P.uniq) (s),
A = (0, P.uniq) (A),
B = (0, P.uniq) (B),
{
links: i,
icons: A,
images: s,
descriptions: j,
files: B
}
},
s(4),
s(53);
var _ = function _interopRequireDefault(n) {
return n && n.__esModule ? n : {
default:
n
}
}(s(94)),
w = s(82),
E = s(45),
P = s(5)
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.decorateTitle = function decorateTitle(n) {
n.length > 0 && (n0.title = !0); return n
}
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.decorateTableBlock = function decorateTableBlock(n) {
for (var _loop = function (s) {
var {
title: E
}
= function detectTableBlockStart(n) {
var i = n.match(/^\s*table:(.+)$/);
if (i) {
var [,
s] = i;
return {
title: s
}
}
return {
}
if (!E) return i = s,
'continue';
var P = (0, w.countIndent) (ns) + 1, A = (0, _.getBlock) (n, s, n=>{
for (var i = [
' '.repeat(P)
], s = [
...n.text.substr(P).split(/(\t)/)
]; s.length > 0; ) i.push(s.shift() + (s.shift() || ''));
n.tableBlock = {
title: E,
indent: P,
cells: i,
start: !1,
end: !1
}
});
ns.tableBlock.start = !0, nA.end.tableBlock.end = !0, s = A.end,
i = s
}, i = 1; i < n.length; i++) _loop(i);
return n
},
s(4);
var _ = s(286),
w = s(45)
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.decorateCli = function decorateCli(n) {
for (var i of n) if (!i.title) {
var s = i.text.match(/^\s*(%$) (.+)/); if (s) {
var [,
_,
w] = s;
i.cli = {
prefix: _,
command: w
}
}
}
return n
},
s(4)
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.decorateHelpfeel = function decorateHelpfeel(n) {
for (var i of n) if (!i.title) {
var s = i.text.match(/^\s*(\?) (.+)/);
if (s) {
var [,
_,
w] = s;
i.helpfeel = {
prefix: _,
entry: w
}
}
}
return n
},
s(4)
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.decorateNumberList = function decorateNumberList(n) {
for (var i of n) if (!i.title) {
var s = i.text.match(/^\s*(\d+)\. /);
if (s) {
var [,
_] = s;
i.numberList = {
digit: _.length
}
}
}
return n
},
s(4)
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.decorateFormula = function decorateFormula(n) {
for (var i of n) if (!(i.title || i.numberList || i.codeBlock || i.tableBlock || i.cli || i.helpfeel)) {
var s = (0, _.parseScrapboxSyntax) (i.text);
('deco-formula' === s.type || 'indent' === s.type && s.children && 'deco-formula' === s.children.type || s.children instanceof Array && 1 === s.children.length && s.children0 && 'deco-formula' === s.children0.type) && (i.formulaLine = !0) }
return n
},
s(4);
var _ = s(82)
},
function (n, i) {
n.exports = function (n) {
return n.source.replace(/\(\((?!\?)/g, (function (n) {
return n + '?:'
})).replace(/(^|^\\)\((?!\?)/g, (function (n) { return n + '?:'
}))
}
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = (0, s(32).createNodeParser) (/\(\s+)\/, ([n, i]) =>({
type: 'blank',
unit: {
content: i,
whole: n
},
children: i
}));
i.default = _
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.parseVideo = void 0,
s(4);
var _ = s(32),
w = s(116),
E = (0, _.createNodeParser) (/\[(https?:\/\/^\\s]+\.(?:mp4|webm))\]/i, ([n, i]) =>({
type: 'video',
unit: {
whole: n,
content: i
},
children: i,
fileId: w.fileUrlPattern.test(i) ? (0, w.parseFileId) (i) : void 0
}));
i.parseVideo = E
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = (0, s(32).createNodeParser) (/\[(https?:\/\/vimeo\.com\/(0-9+))\]/i, ([n, i,
s]) =>({
type: 'vimeo',
unit: {
whole: n,
content: i,
videoId: s
},
children: i
}));
i.default = _
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = s(32),
w = s(116),
E = (0, _.createNodeParser) (/\[(https?:\/\/^\\s]*\.(?:wav|mp3|ogg|aac))\]/i, ([n, i]) =>({
type: 'audio',
unit: {
whole: n,
content: i
},
fileId: w.fileUrlPattern.test(i) ? (0, w.parseFileId) (i) : void 0,
children: i
}));
i.default = E
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseAudioLinkReverse = i.parseAudioLink = void 0,
s(4);
var _ = s(32),
w = s(116),
E = (0, _.createNodeParser) (/\[((https?:\/\/^\s\]+\.(?:wav|mp3|ogg|aac))\s+(^\]*))\]/i, ([n, i,
s,
_]) =>({
type: 'audioLink',
unit: {
whole: n,
content: i,
link: s,
title: _
},
fileId: w.fileUrlPattern.test(s) ? (0, w.parseFileId) (s) : void 0,
children: i
}));
i.parseAudioLink = E;
var P = (0, _.createNodeParser) (/\[(([^\]+)\s+(https?:\/\/^\s\]+\.(?:wav|mp3|ogg|aac)))\]/i, ([n, i,
s,
_]) =>({
type: 'audioLink',
unit: {
whole: n,
content: i,
title: s,
link: _
},
fileId: w.fileUrlPattern.test(_) ? (0, w.parseFileId) (_) : void 0,
children: i
}));
i.parseAudioLinkReverse = P;
var A = (0, _.combineNodeParsers) (E, P);
i.default = A
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = s(32),
w = s(116),
E = (0, _.createNodeParser) (/\[(https?:\/\/^\\s]*\.(?:png|jpe?g|gif|svg|webp)(?:\?^\\s]+)?)\]/i, ([n, i]) =>({
type: 'image',
unit: {
whole: n,
content: i
},
fileId: w.fileUrlPattern.test(i) ? (0, w.parseFileId) (i) : void 0,
children: i
}));
i.default = E
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseImageLinkReverse = i.parseImageLink = void 0,
s(4);
var _ = s(32),
w = (0, _.createNodeParser) (/\[((https?:\/\/^\\s]+)\s+(https?:\/\/^\\s]*\.(?:png|jpe?g|gif|svg|webp)(?:\?^\\s]+)?))\]/i, ([n, i,
s,
_]) =>({
type: 'imageLink',
unit: {
whole: n,
content: i,
link: s,
image: _
},
children: i
}));
i.parseImageLink = w;
var E = (0, _.createNodeParser) (/\[((https?:\/\/^\\s]*\.(?:png|jpe?g|gif|svg|webp)(?:\?^\\s]+)?)\s+(https?:\/\/^\\s]+))\]/i, ([n, i,
s,
_]) =>({
type: 'imageLink',
unit: {
whole: n,
content: i,
image: s,
link: _
},
children: i
}));
i.parseImageLinkReverse = E;
var P = (0, _.combineNodeParsers) (w, E);
i.default = P
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = s(32),
i]) =>({
type: 'gyazo',
unit: {
whole: n,
content: i
},
children: i
})),
i]) =>({
type: 'gyazo',
unit: {
whole: n,
content: i
},
children: i
})),
P = (0, _.combineNodeParsers) (w, E);
i.default = P
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseGyazoExtLinkReverse = i.parseGyazoLinkReverse = i.parseGyazoExtLink = i.parseGyazoLink = void 0,
s(4);
var _ = s(32),
w = (0, _.createNodeParser) (/\[((https?:\/\/^\\s]+)\s+(https?:\/\/(?:a-za-z0-9-*a-z0-9\.|)gyazo\.com\/0-9a-f{32}(?:\/raw)?))\]/, ([n, i,
s,
_]) =>({
type: 'gyazoLink',
unit: {
whole: n,
content: i,
link: s,
gyazo: _
},
children: i
}));
i.parseGyazoLink = w;
var E = (0, _.createNodeParser) (/\[((https?:\/\/^\\s]+)\s+(https?:\/\/(?:a-za-z\d-*a-z\d\.|i\.|)gyazo\.com\/a-z\d{32}\.^.\s+))\]/, ([n, i,
s,
_]) =>({
type: 'gyazoLink',
unit: {
whole: n,
content: i,
link: s,
gyazo: _
},
children: i
}));
i.parseGyazoExtLink = E;
var P = (0, _.createNodeParser) (/\[((https?:\/\/(?:a-za-z0-9-*a-z0-9\.|)gyazo\.com\/0-9a-f{32}(?:\/raw)?)\s+(https?:\/\/^\\s]+))\]/, ([n, i,
s,
_]) =>({
type: 'gyazoLink',
unit: {
whole: n,
content: i,
link: _,
gyazo: s
},
children: i
}));
i.parseGyazoLinkReverse = P;
var A = (0, _.createNodeParser) (/\[((https?:\/\/(?:a-za-z\d-*a-z\d\.|i\.|)gyazo\.com\/a-z\d{32}\.^.\s+)\s+(https?:\/\/^\\s]+))\]/, ([n, i,
s,
_]) =>({
type: 'gyazoLink',
unit: {
whole: n,
content: i,
link: _,
gyazo: s
},
children: i
}));
i.parseGyazoExtLinkReverse = A;
var j = (0, _.combineNodeParsers) (w, E, P, A);
i.default = j
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseProjectRootLink = i.parseProjectLineLink = i.parseProjectLink = i.parseLineLink = i.parsePageLink = void 0,
s(4);
var _ = s(32),
w = (0, _.createNodeParser) (/\[([^\]+)\]/, ([, n]) =>({
type: 'link',
unit: {
page: n,
get content() {
return this.page
},
get whole() {
}
},
children: n
}));
i.parsePageLink = w;
var E = (0, _.createNodeParser) (/\[(([^\]+)#(a-f\d{24,32}))\]/, ([, n,
i,
s]) =>({
type: 'link',
unit: {
page: i,
line: s,
get content() {
return this.page + '#' + this.line
},
get whole() {
}
},
children: n
}));
i.parseLineLink = E;
var P = (0, _.createNodeParser) (/\[(\/(a-z0-9-+)\/([^\]+))\]/i, ([, n,
i,
s]) =>({
type: 'link',
unit: {
project: i,
page: s,
get content() {
return '/'.concat(this.project, '/').concat(this.page)
},
get whole() {
}
},
children: n
}));
i.parseProjectLink = P;
var A = (0, _.createNodeParser) (/\[(\/(a-z0-9-+)\/([^\]+)#(a-f\d{24,32}))\]/i, ([, n,
i,
s,
_]) =>({
type: 'link',
unit: {
project: i,
page: s,
line: _,
get content() {
return '/'.concat(this.project, '/').concat(this.page, '#').concat(this.line)
},
get whole() {
}
},
children: n
}));
i.parseProjectLineLink = A;
var j = (0, _.createNodeParser) (/\[(\/(a-z0-9-+)\/?)\]/i, ([n, i,
s]) =>({
type: 'link',
unit: {
whole: n,
content: i,
project: s
},
children: i
}));
i.parseProjectRootLink = j;
var B = (0, _.combineNodeParsers) (j, A, P, E, w);
i.default = B
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.parseHashTag = void 0,
s(4);
var _ = (0, s(32).createNodeParser) (/(^|\s)#(^\s+)/, ([, n,
i]) =>{
var s = {
type: 'hashTag',
unit: {
page: i,
tag: '#',
get content() {
return this.page
},
get whole() {
return '#' + this.page
}
},
children: '#' + i
};
return n ? [
n,
s
] : s
});
i.parseHashTag = _
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseProjectIconTower = i.parseProjectIcon = i.parseIconTower = i.parseIcon = void 0,
s(4);
var _ = s(32),
w = (0, _.createNodeParser) (/\[(([^\]+)\.icon)\]/, ([, n,
i]) =>({
type: 'icon',
unit: {
page: i,
size: 1,
get content() {
return ''.concat(this.page, '.icon')
},
get whole() {
}
},
children: n
}));
i.parseIcon = w;
var E = (0, _.createNodeParser) (/\[(([^\]+)\.icon(*x)(1-9\d*))\]/, ([, n,
i,
s,
_]) =>({
type: 'icon',
unit: {
page: i,
size: _ -= 0,
get content() {
return ''.concat(this.page, '.icon').concat(s).concat(_)
},
get whole() {
}
},
children: n
}));
i.parseIconTower = E;
var P = (0, _.createNodeParser) (/\[(\/(a-zA-Z0-9-+)\/([^\]+)\.icon)\]/, ([n, i,
s,
_]) =>({
type: 'icon',
unit: {
project: s,
page: _,
size: 1,
get content() {
return '/'.concat(this.project, '/').concat(this.page, '.icon')
},
get whole() {
}
},
children: i
}));
i.parseProjectIcon = P;
var A = (0, _.createNodeParser) (/\[(\/(a-zA-Z0-9-+)\/([^\]+)\.icon(*x)(1-9\d*))\]/, ([n, i,
s,
_,
w,
E]) =>({
type: 'icon',
unit: {
project: s,
page: _,
size: E -= 0,
get content() {
return '/'.concat(this.project, '/').concat(this.page, '.icon').concat(w).concat(E)
},
get whole() {
}
},
children: i
}));
i.parseProjectIconTower = A;
var j = (0, _.combineNodeParsers) (P, A, w, E);
i.default = j
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseStrongProjectIconTower = i.parseStrongProjectIcon = i.parseStrongIconTower = i.parseStrongIcon = void 0,
s(4);
var _ = s(32),
w = (0, _.createNodeParser) (/\[\[(([^\]+)\.icon)\]\]/, ([, n,
i]) =>({
type: 'strong-icon',
unit: {
page: i,
size: 1,
get content() {
return ''.concat(this.page, '.icon')
},
get whole() {
return ''.concat(this.content, '')
}
},
children: n
}));
i.parseStrongIcon = w;
var E = (0, _.createNodeParser) (/\[\[(([^\]+)\.icon(*x)(1-9\d*))\]\]/, ([, n,
i,
s,
_]) =>({
type: 'strong-icon',
unit: {
page: i,
size: _ -= 0,
get content() {
return ''.concat(this.page, '.icon').concat(s).concat(this.size)
},
get whole() {
return ''.concat(this.content, '')
}
},
children: n
}));
i.parseStrongIconTower = E;
var P = (0, _.createNodeParser) (/\[\[(\/(a-zA-Z0-9-+)\/([^\]+)\.icon)\]\]/, ([, n,
i,
s]) =>({
type: 'strong-icon',
unit: {
project: i,
page: s,
size: 1,
get content() {
return '/'.concat(this.project, '/').concat(this.page, '.icon')
},
get whole() {
return ''.concat(this.content, '')
}
},
children: n
}));
i.parseStrongProjectIcon = P;
var A = (0, _.createNodeParser) (/\[\[(\/(a-zA-Z0-9-+)\/([^\]+)\.icon(*x)(1-9\d*))\]\]/, ([n, i,
s,
_,
w,
E]) =>({
type: 'strong-icon',
unit: {
project: s,
page: _,
size: E -= 0,
get content() {
return '/'.concat(this.project, '/').concat(this.page, '.icon').concat(w).concat(this.size)
},
get whole() {
return ''.concat(this.content, '')
}
},
children: i
}));
i.parseStrongProjectIconTower = A;
var j = (0, _.combineNodeParsers) (P, A, w, E);
i.default = j
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseStrongGyazoExtLinkReverse = i.parseStrongGyazoExtLink = i.parseStrongGyazoLinkReverse = i.parseStrongGyazoLink = i.parseStrongImageLinkReverse = i.parseStrongImageLink = i.parseStrongGyazoExt = i.parseStrongGyazo = i.parseStrongImage = void 0,
s(4);
var _ = s(32),
w = s(116),
E = (0, _.createNodeParser) (/\[\[(https?:\/\/^\\s]*\.(?:png|jpe?g|gif|svg|webp)(?:\?^\\s]+)?)\]\]/i, ([n, i]) =>({
type: 'strongImage',
unit: {
whole: n,
content: i
},
children: i,
fileId: w.fileUrlPattern.test(i) ? (0, w.parseFileId) (i) : void 0
}));
i.parseStrongImage = E;
i]) =>({
type: 'strongGyazo',
unit: {
whole: n,
content: i
},
children: i
}));
i.parseStrongGyazo = P;
var A = (0, _.createNodeParser) (/\[\[(https?:\/\/(?:a-za-z\d-*a-z\d\.|i\.|)gyazo\.com\/a-z\d{32}\.^.\s+)\]\]/, ([n, i]) =>({
type: 'strongGyazo',
unit: {
whole: n,
content: i
},
children: i
}));
i.parseStrongGyazoExt = A;
var j = (0, _.createNodeParser) (/\[\[((https?:\/\/^\\s]+)\s+(https?:\/\/^\\s]*\.(?:png|jpe?g|gif|svg|webp)(?:\?^\\s]+)?))\]\]/, ([n, i,
s,
_]) =>({
type: 'strongImageLink',
unit: {
whole: n,
content: i,
link: s,
image: _
},
children: i
}));
i.parseStrongImageLink = j;
var B = (0, _.createNodeParser) (/\[\[((https?:\/\/^\\s]*\.(?:png|jpe?g|gif|svg|webp)(?:\?^\\s]+)?)\s+(https?:\/\/^\\s]+))\]\]/, ([n, i,
s,
_]) =>({
type: 'strongImageLink',
unit: {
whole: n,
content: i,
link: _,
image: s
},
children: i
}));
i.parseStrongImageLinkReverse = B;
var $ = (0, _.createNodeParser) (/\[\[((https?:\/\/^\\s]+)\s+(https?:\/\/(?:a-za-z0-9-*a-z0-9\.|)gyazo\.com\/0-9a-f{32}))\]\]/, ([n, i,
s,
_]) =>({
type: 'strongGyazoLink',
unit: {
whole: n,
content: i,
link: s,
gyazo: _
},
children: i
}));
i.parseStrongGyazoLink = $;
var ne = (0, _.createNodeParser) (/\[\[((https?:\/\/(?:a-za-z0-9-*a-z0-9\.|)gyazo\.com\/0-9a-f{32})\s+(https?:\/\/^\\s]+))\]\]/, ([n, i,
s,
_]) =>({
type: 'strongGyazoLink',
unit: {
whole: n,
content: i,
gyazo: s,
link: _
},
children: i
}));
i.parseStrongGyazoLinkReverse = ne;
var ie = (0, _.createNodeParser) (/\[\[((https?:\/\/^\\s]+)\s+(https?:\/\/(?:a-za-z\d-*a-z\d\.|i\.|)gyazo\.com\/a-z\d{32}\.^.\s+))\]\]/, ([n, i,
s,
_]) =>({
type: 'strongGyazoLink',
unit: {
whole: n,
content: i,
link: s,
gyazo: _
},
children: i
}));
i.parseStrongGyazoExtLink = ie;
var oe = (0, _.createNodeParser) (/\[\[((https?:\/\/(?:a-za-z\d-*a-z\d\.|i\.|)gyazo\.com\/a-z\d{32}\.^.\s+)\s+(https?:\/\/^\\s]+))\]\]/, ([n, i,
s,
_]) =>({
type: 'strongGyazoLink',
unit: {
whole: n,
content: i,
link: _,
gyazo: s
},
children: i
}));
i.parseStrongGyazoExtLinkReverse = oe;
var se = (0, _.combineNodeParsers) (P, A, E, $, ne, ie, oe, j, B);
i.default = se
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseFormula2 = i.parseFormula = i.parseDeco = void 0,
s(4);
var _ = s(32),
i,
s]) =>({
type: 'deco',
unit: {
whole: n,
content: s,
deco: i,
strong: i.includes('*') ? Math.min(i.match(/\*/g).length, 10) : 0,
italic: i.includes('/'),
strike: i.includes('-'),
underline: i.includes('_')
},
children: s
}));
i.parseDeco = w;
i,
s]) =>({
type: 'deco-formula',
unit: {
whole: n,
content: i,
formula: s
},
children: i
}));
i.parseFormula = E;
var P = (0, _.createNodeParser) (/\[(\$ (^\]+))\]/, ([n, i,
s]) =>({
type: 'deco-formula',
unit: {
whole: n,
content: i,
formula: s
},
children: i
}));
i.parseFormula2 = P;
var A = (0, _.combineNodeParsers) (w, E, P);
i.default = A
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = (0, s(32).createNodeParser) (/\[\[((?:[^[]|\[[^[]).*?\]*)\]\]/, ([,
n]) =>({
type: 'strong',
unit: {
content: n,
whole: ''.concat(n, '')
},
children: n
}));
i.default = _
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = s(32),
w = s(116),
E = (0, _.createNodeParser) (/(https?:\/\/^\s+)/, ([, n]) =>({
type: 'url',
unit: {
content: n,
whole: n
},
fileId: w.fileUrlPattern.test(n) ? (0, w.parseFileId) (n) : void 0,
children: n
}));
i.default = E
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseUrlLinkWithTitleReverse = i.parseUrlLinkWithTitle = i.parseUrlLink = void 0,
s(4);
var _ = s(32),
w = s(116),
E = (0, _.createNodeParser) (/\[(https?:\/\/^\s\]+)\]/, ([, n]) =>({
type: 'urlLink',
unit: {
link: n,
content: n,
},
fileId: w.fileUrlPattern.test(n) ? (0, w.parseFileId) (n) : void 0,
children: n
}));
i.parseUrlLink = E;
var P = (0, _.createNodeParser) (/\[((https?:\/\/^\s\]+)\s+(^\]*^\s))\]/, ([, n,
i,
s]) =>({
type: 'urlLink',
unit: {
link: i,
title: s,
content: n,
},
fileId: w.fileUrlPattern.test(i) ? (0, w.parseFileId) (i) : void 0,
children: n
}));
i.parseUrlLinkWithTitle = P;
var A = (0, _.createNodeParser) (/\[(([^\]*^\s)\s+(https?:\/\/^\s\]+))\]/, ([, n,
i,
s]) =>({
type: 'urlLink',
unit: {
link: s,
title: i,
content: n,
},
fileId: w.fileUrlPattern.test(s) ? (0, w.parseFileId) (s) : void 0,
children: n
}));
i.parseUrlLinkWithTitleReverse = A;
var j = (0, _.combineNodeParsers) (P, A, E);
i.default = j
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.parseParams = parseParams,
i.normalizeTime = normalizeTime,
i.default = i.parseYoutubeList = i.parseYoutubeShortUrl = i.parseYoutubeCom = void 0,
s(4);
var _ = s(32);
function parseParams(n) {
var i = {
};
if (!n) return i;
for (var s of n.split('&')) if (s) {
var [_,
w] = s.split('=');
}
return i.t && (i.t = normalizeTime(i.t)),
i
}
function normalizeTime(n) {
if (/^\d+$/.test(n)) return parseInt(n);
var i = 0;
for (var [s,
_]of[[/(\d+)s/,
n=>n],
[
/(\d+)m/,
n=>60 * n
],
[
/(\d+)h/,
n=>3600 * n
]]) s.test(n) && (i += _(parseInt(n.match(s) 1))); return i || n
}
var w = (0, _.createNodeParser) (/\[(https?:\/\/(?:www\.|)youtube\.com\/watch\?((?:^\s+&|)v=(a-zA-Z\d_-+)(?:&^\s+|)))\]/, ([n, i,
s,
_]) =>({
type: 'youtube',
unit: {
whole: n,
content: i,
videoId: _,
params: parseParams(s)
},
children: i
}));
i.parseYoutubeCom = w;
var E = (0, _.createNodeParser) (/\[(https?:\/\/youtu\.be\/(a-zA-Z\d_-+)(?:\?(^\s{0,100})|))\]/, ([n, i,
s,
_]) =>({
type: 'youtube',
unit: {
whole: n,
content: i,
videoId: s,
params: parseParams(_)
},
children: i
}));
i.parseYoutubeShortUrl = E;
var P = (0, _.createNodeParser) (/\[(https?:\/\/(?:www\.|)youtube\.com\/playlist\?((?:^\s+&|)list=(a-zA-Z\d_-+)(?:&^\s+|)))\]/, ([n, i,
s,
_]) =>({
type: 'youtube',
unit: {
whole: n,
content: i,
listId: _,
params: parseParams(s)
},
children: i
}));
i.parseYoutubeList = P;
var A = (0, _.combineNodeParsers) (w, E, P);
i.default = A
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = i.parseLocationTitleReverse = i.parseLocationTitle = i.parseLocation = void 0,
s(17),
s(4);
var _ = s(32),
normalizeLatitude = n=>parseFloat(n.replace(/^N/, '').replace(/^S/, '-')),
normalizeLongitude = n=>parseFloat(n.replace(/^E/, '').replace(/^W/, '-')),
w = (0, _.createNodeParser) (/\[((NS\d+(?:\.\d+)?),(EW\d+(?:\.\d+)?)(?:|,Z(\d+)))\]/, ([n, i,
s,
_,
w]) =>({
type: 'location',
unit: {
whole: n,
content: i,
latitude: normalizeLatitude(s),
longitude: normalizeLongitude(_),
zoom: w && parseInt(w)
},
children: i
}));
i.parseLocation = w;
var E = (0, _.createNodeParser) (/\[((NS\d+(?:\.\d+)?),(EW\d+(?:\.\d+)?)(?:|,Z(\d+)) ([^\]+))\]/, ([n, i,
s,
_,
w,
E]) =>({
type: 'location',
unit: {
whole: n,
content: i,
latitude: normalizeLatitude(s),
longitude: normalizeLongitude(_),
zoom: w && parseInt(w),
title: E
},
children: i
}));
i.parseLocationTitle = E;
var P = (0, _.createNodeParser) (/\[(([^\]+) (NS\d+(?:\.\d+)?),(EW\d+(?:\.\d+)?)(?:|,Z(\d+)))\]/, ([n, i,
s,
_,
w,
E]) =>({
type: 'location',
unit: {
whole: n,
content: i,
latitude: normalizeLatitude(_),
longitude: normalizeLongitude(w),
zoom: E && parseInt(E),
title: s
},
children: i
}));
i.parseLocationTitleReverse = P;
var A = (0, _.combineNodeParsers) (w, E, P);
i.default = A
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = (0, s(32).createNodeParser) (/^(>\s*)(.*?)$/, ([n,
i,
s]) =>({
type: 'quote',
unit: {
whole: n,
tag: i,
content: s
},
children: s
}));
i.default = _
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = (0, s(32).createNodeParser) (/((?:\\`|[^])*)`/, ([n,
i]) =>({
type: 'code',
unit: {
whole: n,
content: i
},
children: i
}));
i.default = _
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.default = void 0,
s(4);
var _ = (0, s(32).createNodeParser) (/^(\t\s+)(.*)$/, ([n, i,
s]) =>({
type: 'indent',
unit: {
whole: n,
tag: i,
content: s
},
children: s
}));
i.default = _
},
function (n, i, s) {
'use strict';
Object.defineProperty(i, '__esModule', {
value: !0
}),
i.isNode = isNode,
i.eachNode = eachNode,
i.getLinksFromNode = function getLinksFromNode(n) {
var i = [
];
return eachNode(n, n=>{
switch (n.type) {
case 'link':
var {
page: s,
project: _
}
= n.unit;
!_ && (0, w.validatePageTitle) (s).isValid && i.push(s);
break;
case 'hashTag':
var {
page: E
}
= n.unit;
(0, w.validatePageTitle) (E).isValid && i.push(E)
}
}),
(0, _.uniq) (i)
},
i.getIconsFromNode = function getIconsFromNode(n) {
var i = [
];
return eachNode(n, n=>{
switch (n.type) {
case 'icon':
case 'strong-icon':
var {
project: s,
page: _
}
= n.unit;
!s && (0, w.validatePageTitle) (_).isValid && i.push(_)
}
}),
(0, _.uniq) (i)
},
i.getImagesFromNode = function getImagesFromNode(n) {
var i = [
];
return eachNode(n, n=>{
switch (n.type) {
case 'gyazo':
case 'strongGyazo':
i.push((0, E.toGyazoRawUrl) (n.children));
break;
case 'gyazoLink':
case 'strongGyazoLink':
i.push((0, E.toGyazoRawUrl) (n.unit.gyazo));
break;
case 'image':
case 'strongImage':
i.push(n.unit.content);
break;
case 'imageLink':
case 'strongImageLink':
i.push(n.unit.image);
break;
case 'youtube':
if (!n.unit.videoId) break;
}
}),
(0, _.uniq) (i)
},
i.getFilesFromNode = function getFilesFromNode(n) {
var i = [
];
return eachNode(n, n=>{
n.fileId && i.push(n.fileId)
}),
(0, _.uniq) (i)
},
i.isHashTagOnlyNode = function isHashTagOnlyNode(n) {
if ('string' == typeof n) return /^\s+$/.test(n);
if (n instanceof Array) return !n.find(n=>!1 === isHashTagOnlyNode(n));
switch (n.type) {
case 'indent':
return isHashTagOnlyNode(n.children);
case 'hashTag':
return !0;
default:
return !1
}
};
var _ = s(5),
w = s(162),
E = s(129);
function isNode(n) {
return !(!n.type || !n.unit) || 'string' == typeof n
}
function eachNode(n, i) {
if ('function' == typeof i) return n instanceof Array ? n.forEach(n=>eachNode(n, i)) : (isNode(n) && i(n), n.children ? eachNode(n.children, i) : void 0)
}
},